package com.erlinyou.im.dao.repository.group;


import java.util.List;

import org.springframework.data.jpa.repository.Query;

import com.erlinyou.base.dao.BaseRepository;
import com.erlinyou.im.model.group.Group;

public interface GroupRepository extends BaseRepository<Group, Integer>{

	@Query(value="SELECT * from tgroup g LEFT JOIN  tgroup_members m ON g.id = m.groupid where m.userid = ?1 and g.gtype = ?2",nativeQuery=true)
	List<Group> selectBygroup(Long userId,int gtype);

	List<Group> findByGtype(Integer gtype);

	Group findByPoiId(String poiId);

	Group findByOwnerAndGtype(Long userId, int gtype);

	Group findByPoiIdAndGtype(String userId, int gtype);

//	List<Group> findAllByUserid(Long userId);

	
}
